#pragma once
#include<iostream>
#include<iostream>
#include<string>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<memory.h>
#include<functional>
#include<fcntl.h>
enum ExitCode
{
    OK=0,
    EXIT_EER,
    SOCK_ERR,
    BIND_ERR,
    LISTEN_ERR,
    USAGE_ERR,
    CONNECT_ERR,
    OPEN_ERR,
    EPOLL_CREAT_ERR,
    EPOLL_CTL_ERR
};

class NoCopy
{
public:
    NoCopy(){};
    ~NoCopy(){};
    NoCopy(const NoCopy&) = delete;
    const NoCopy& operator=(const NoCopy&) = delete; 
};

void SetNonBlock(int fd)
{
    std::cout<<fd<<"已经被设置为非阻塞文件..."<<std::endl;
    int fl=fcntl(fd,F_GETFL);
    fcntl(fd,F_SETFL,fl | O_NONBLOCK); 
}

int defaultport = 8080;

#define CONV(addr) ((struct sockaddr*)&addr)